static void stop_svm(void)
{
u32 eax, edx;
- int cpu = smp_processor_id();
-
/* We turn off the EFER_SVME bit. */
rdmsr(MSR_EFER, eax, edx);
eax &= ~EFER_SVME;
wrmsr(MSR_EFER, eax, edx);
-
- /* release the HSA */
- free_host_save_area(hsa[cpu]);
- hsa[cpu] = NULL;
- wrmsr(MSR_K8_VM_HSAVE_PA, 0, 0 );
-
- /* free up the root vmcb */
- free_vmcb(root_vmcb[cpu]);
- root_vmcb[cpu] = NULL;
- root_vmcb_pa[cpu] = 0;
}
static void svm_store_cpu_guest_regs(
return 0;
}
- if (!(hsa[cpu] = alloc_host_save_area()))
- return 0;
+ if (!hsa[cpu])
+ if (!(hsa[cpu] = alloc_host_save_area()))
+ return 0;
rdmsr(MSR_EFER, eax, edx);
eax |= EFER_SVME;
phys_hsa_hi = (u32) (phys_hsa >> 32);
wrmsr(MSR_K8_VM_HSAVE_PA, phys_hsa_lo, phys_hsa_hi);
- if (!(root_vmcb[cpu] = alloc_vmcb()))
- return 0;
+ if (!root_vmcb[cpu])
+ if (!(root_vmcb[cpu] = alloc_vmcb()))
+ return 0;
root_vmcb_pa[cpu] = virt_to_maddr(root_vmcb[cpu]);
if (cpu == 0)
return hsa;
}
-void free_host_save_area(struct host_save_area *hsa)
-{
- free_xenheap_page(hsa);
-}
-
static int construct_vmcb(struct vcpu *v)
{
struct arch_svm_struct *arch_svm = &v->arch.hvm_svm;
struct vmcb_struct *alloc_vmcb(void);
struct host_save_area *alloc_host_save_area(void);
void free_vmcb(struct vmcb_struct *vmcb);
-void free_host_save_area(struct host_save_area *hsa);
int svm_create_vmcb(struct vcpu *v);
void svm_destroy_vmcb(struct vcpu *v);